# Enable mouse mode
set -g mouse on

# Optional: Scroll with the mouse while in copy mode
bind -T copy-mode-vi WheelUpPane send-keys -X scroll-up
bind -T copy-mode-vi WheelDownPane send-keys -X scroll-down
bind -T copy-mode WheelUpPane send-keys -X scroll-up
bind -T copy-mode WheelDownPane send-keys -X scroll-down

# Custom keybinding to kill the session
bind C-q kill-session -t pyslam_session


# Enable search functionality in copy mode
# Start searching forward (/) or backward (?)
bind-key / copy-mode \; send-keys /
bind-key ? copy-mode \; send-keys ?

# Repeat the last search forward (n) or backward (N)
bind-key n send-keys n
bind-key N send-keys N

# To initiate a search, you can:
# 1. Enter copy mode (Ctrl+b [) and press / or ?
# 2. Directly press / or ? while in a pane

# Use Ctrl+F to enter forward search mode and automatically initiate the search.
# After pressing Ctrl+F, type your search term and press Enter to jump to the first match.
bind-key C-f copy-mode \; send-keys / \; send-keys <space> # The spacebar triggers the search



# Optional: Set a prefix key to avoid conflicts with other applications
set -g prefix C-a


# NOTES 
# Use CTRL+A to activate the interaction with tmux. 
# Then, use:
#    CTRL+Q to kill the pyslam_session 
#    CTRL+F to get into search mode     [mmm... does not work well yet]


# Once you interact with a tmux panel then press 'q' to exit the interaction mode.